package gongchangmoshi

/**
抽象工厂模式
*/

type Paper interface {
	Name() string
}

type chinesePaper struct {
	name string
}

func (ch *chinesePaper) Name() string {
	return ch.name
}

type englishPaper struct {
	name string
}

func (en *englishPaper) Name() string {
	return en.name
}

type Assigner interface {
	GetPaper(name string) Paper
}

type assigner struct{}

func (as assigner) GetPaper(name string) Paper {

	var paper Paper
	switch name {
	case "chinese":
		paper = &chinesePaper{name: "中文书"}
	case "english":
		paper = &englishPaper{name: "英语书"}
	}
	return paper
}
